import MySQLdb

# initialize DB connection
db = MySQLdb.connect(host='localhost', user='root', db='gradapp', charset='utf8', use_unicode=True)
cursor = db.cursor()

# read file and move data
file = open('../WebContent/majors.txt', 'r')
has_universities = False
for item in file.readlines():
	sql = """INSERT INTO Disciplines (name) VALUES (%s)"""
	cursor.execute(sql, item.strip())
cursor.close()
db.commit()
